using System;
using System.IO;

namespace Atomic.Vasp.LinearResponse
{
	/// <summary>
	/// Linear response (IBRION=7,8). The Hessian of the energy is determined using density functional perturbation theory (DFPT).
	/// http://cms.mpi.univie.ac.at/vasp/vasp/IBRION_7_IBRION_8.html
	/// </summary>
	[Serializable]
	public class LinearResponsePerturbation : VaspLinearResponseOption
	{
		public LinearResponsePerturbation()
			: this(true)
		{
		}

		public LinearResponsePerturbation(bool useSymmetry)
		{
			UseSymmetry = useSymmetry;
		}

		public override void Write(VaspIncar incar, DirectoryInfo directory)
		{
			// http://cms.mpi.univie.ac.at/vasp/vasp/IBRION_7_IBRION_8.html
			int code;
			if (UseSymmetry)
			{
				code = 8;
			}
			else
			{
				code = 7;
			}

			incar.Add("IBRION", code.ToString(), "Linear response");
		}

		public bool UseSymmetry
		{
			get;
			private set;
		}
	}
}
